Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect negated assertion for rule existence check #345

Merged
merged 2 commits into from
Nov 21, 2021
Merged

fix: incorrect negated assertion for rule existence check #345

merged 2 commits into from
Nov 21, 2021

Conversation

noahnu
Copy link
Contributor

@noahnu noahnu commented Oct 8, 2020

Closes #344

const matcherTest = (received, expected) => {
const matcherTest = (received, expected, isNot) => {
// when negating, assert on existence of the style, rather than the value
if (isNot && expected === undefined) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the strictness of the "falsey expected" condition. I believe the intention was to check for the existence of the second parameter to toHaveStyleRule, so "=== undefined" is better here. I can relax this, if there's concern around it being a breaking change.

@noahnu
Copy link
Contributor Author

noahnu commented Aug 24, 2021

@probablyup This and the associated issue has been open since 2020. Do you think this change makes sense?

Copy link
Contributor

@quantizor quantizor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, sorry for the delay

@quantizor quantizor merged commit a712c13 into styled-components:main Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toHaveStyleRule does not work correctly with negation
2 participants